<div id="ninja_debug">
  <div id="debug_link">
    <%= link_to_function image_tag('nwd/nw_debugger_icon.png', :width => '30px', :title => 'Ninja Web Debugger', :alt => '[debugger]'), visual_effect(:toggle_blind, :debug_panel, :duration => 0.3) %>
  </div>
  
  <div id="debug_panel" style='display:none;'>
    <div id="reload">
      <%= link_to_remote '[reload]', :url => {:controller => 'ninja_web_debugger', :action => 'reload', :key => @log_key, :request_id => @request_id} %>
    </div>

    <ul id='debug_menu'>
    <div id="db_summary"><%= @logs[:db_total_calls] %> <%= image_tag('nwd/database.png') %> calls </div>
    <div id="time_summary"><%= image_tag('nwd/time.png') %> <%= @logs[:request_timing][:duration] %> ms | <%= (1/@logs[:request_timing][:duration]).round %> reqs/sec</div>
     <br/>
      <% @logs.each_pair do |key, value| -%>
      <li><%= link_to_function("[show/hide #{key}]", visual_effect(:toggle_blind, "nwd_#{key}", :duration => 0.5) ) %>
        <div id="nwd_<%= key %>" style='display:none;'>
          <span class='debug_title'><%= key %>:</span> 
          
          <dl>
            <% if value.is_a? Hash %>
              <% value.each_pair do |k, v| %>
              <div id="<%= k %>" class="session_info<%= v.blank? ? '_empty' : '' %>">
                <dt><%= k %>: 
                  <dd class='debug_data'> <%= v.is_a?(Array) ? v.to_sentence : v %>
                  </div>
              <% end -%>
            <% elsif value.is_a?(String) || value.is_a?(Integer) %>
              <%= h value %>
            <% end -%>
          </dl>
              
            </div>
        </li>
        <% end -%>
    </ul>

  </div>
</div>